package com.fruit.web.bo;

import java.io.Serializable;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.sql.Timestamp;

import com.fruit.service.ICityService;
import com.fruit.service.ICountyService;
import com.fruit.service.IProvinceService;
import com.fruit.utils.DESPlusUtil;
import com.fruit.utils.SpringFacesUtil;
import com.fruit.web.bo.impl.City;
import com.fruit.web.bo.impl.County;
import com.fruit.web.bo.impl.Customer;
import com.fruit.web.bo.impl.Province;
import com.fruit.web.constant.SpringBeanConstants;
public class AbstractOrder extends java.lang.Object implements Serializable {

	private Long id;
	private String orderId;
	private String status;//success(su),waiting for being reviewed(wr),prepare goods(pg),transfer(tr),waiting outstock(wo),outstock(os),refund(rf),cancel by customer(cc),cancel by user(cu),cancel by system(cs)
	private String consigneeId;// this is used to record wether used default consignee
	private String consigneeName;
	private String consigneeMobile;
	private String consigneePhone;
	private String consigneeFax;
	private String consigneeZip;
	private String consigneeProvince;
	private String consigneeCity;
	private String consigneeCounty;
	private String consigneeAddress;
	private String deliveryId;
	private String deliveryName;
	private Double deliveryExpense;
	private String deliveryDescription;
	private String paymentType;
	private String paymentTypeDisplay;
	private String paymentId;
	private String paymentName;
	private Double paymentExpense;
	private String paymentDescription;
	private String paymentTypeId;
	private String invoiceType;
	private String invoiceTypeDisplay;
	private String invoiceTitle;//use for common invoice only
	private String invoiceCompanyName;
	private String invoiceCompanyAddress;
	private String invoiceCompanyPhone;
	private String taxAccount;
	private String bankName;
	private String accountNumber;
	private String invoicePostAddress;
	private String convenientReceive;// a time for customer receive goods.
	private String remark;
	private java.sql.Timestamp orderGenerateTime;
	private String couponAccount;
	private Double couponScore;
	private Double integrationScore;
	private Double totallPrice;
	private Double needPayment;
	
	public AbstractOrder() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getConsigneeId() {
		return consigneeId;
	}

	public void setConsigneeId(String consigneeId) {
		this.consigneeId = consigneeId;
	}

	public String getConsigneeName() {
		return consigneeName;
	}

	public void setConsigneeName(String consigneeName) {
		this.consigneeName = consigneeName;
	}

	public String getConsigneeMobile() {
		return consigneeMobile;
	}

	public void setConsigneeMobile(String consigneeMobile) {
		this.consigneeMobile = consigneeMobile;
	}

	public String getConsigneePhone() {
		return consigneePhone;
	}

	public void setConsigneePhone(String consigneePhone) {
		this.consigneePhone = consigneePhone;
	}

	public String getConsigneeFax() {
		return consigneeFax;
	}

	public void setConsigneeFax(String consigneeFax) {
		this.consigneeFax = consigneeFax;
	}

	public String getConsigneeZip() {
		return consigneeZip;
	}

	public void setConsigneeZip(String consigneeZip) {
		this.consigneeZip = consigneeZip;
	}

	public String getConsigneeProvince() {
		return consigneeProvince;
	}

	public void setConsigneeProvince(String consigneeProvince) {
		this.consigneeProvince = consigneeProvince;
	}

	public String getConsigneeCity() {
		return consigneeCity;
	}

	public void setConsigneeCity(String consigneeCity) {
		this.consigneeCity = consigneeCity;
	}

	public String getConsigneeCounty() {
		return consigneeCounty;
	}

	public void setConsigneeCounty(String consigneeCounty) {
		this.consigneeCounty = consigneeCounty;
	}

	public String getConsigneeAddress() {
		return consigneeAddress;
	}

	public void setConsigneeAddress(String consigneeAddress) {
		this.consigneeAddress = consigneeAddress;
	}

	public String getDeliveryId() {
		return deliveryId;
	}

	public void setDeliveryId(String deliveryId) {
		this.deliveryId = deliveryId;
	}

	public String getDeliveryName() {
		return deliveryName;
	}

	public void setDeliveryName(String deliveryName) {
		this.deliveryName = deliveryName;
	}

	public Double getDeliveryExpense() {
		return deliveryExpense;
	}

	public void setDeliveryExpense(Double deliveryExpense) {
		this.deliveryExpense = deliveryExpense;
	}

	public String getDeliveryDescription() {
		return deliveryDescription;
	}

	public void setDeliveryDescription(String deliveryDescription) {
		this.deliveryDescription = deliveryDescription;
	}

	public String getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}

	public String getPaymentTypeDisplay() {
		return paymentTypeDisplay;
	}

	public void setPaymentTypeDisplay(String paymentTypeDisplay) {
		this.paymentTypeDisplay = paymentTypeDisplay;
	}

	public String getPaymentId() {
		return paymentId;
	}

	public void setPaymentId(String paymentId) {
		this.paymentId = paymentId;
	}

	public String getPaymentName() {
		return paymentName;
	}

	public void setPaymentName(String paymentName) {
		this.paymentName = paymentName;
	}

	public Double getPaymentExpense() {
		return paymentExpense;
	}

	public void setPaymentExpense(Double paymentExpense) {
		this.paymentExpense = paymentExpense;
	}

	public String getPaymentDescription() {
		return paymentDescription;
	}

	public void setPaymentDescription(String paymentDescription) {
		this.paymentDescription = paymentDescription;
	}

	public String getPaymentTypeId() {
		return paymentTypeId;
	}

	public void setPaymentTypeId(String paymentTypeId) {
		this.paymentTypeId = paymentTypeId;
	}

	public String getInvoiceType() {
		return invoiceType;
	}

	public void setInvoiceType(String invoiceType) {
		this.invoiceType = invoiceType;
	}

	public String getInvoiceTypeDisplay() {
		return invoiceTypeDisplay;
	}

	public void setInvoiceTypeDisplay(String invoiceTypeDisplay) {
		this.invoiceTypeDisplay = invoiceTypeDisplay;
	}

	public String getInvoiceTitle() {
		return invoiceTitle;
	}

	public void setInvoiceTitle(String invoiceTitle) {
		this.invoiceTitle = invoiceTitle;
	}

	public String getInvoiceCompanyName() {
		return invoiceCompanyName;
	}

	public void setInvoiceCompanyName(String invoiceCompanyName) {
		this.invoiceCompanyName = invoiceCompanyName;
	}

	public String getInvoiceCompanyAddress() {
		return invoiceCompanyAddress;
	}

	public void setInvoiceCompanyAddress(String invoiceCompanyAddress) {
		this.invoiceCompanyAddress = invoiceCompanyAddress;
	}

	public String getInvoiceCompanyPhone() {
		return invoiceCompanyPhone;
	}

	public void setInvoiceCompanyPhone(String invoiceCompanyPhone) {
		this.invoiceCompanyPhone = invoiceCompanyPhone;
	}

	public String getTaxAccount() {
		return taxAccount;
	}

	public void setTaxAccount(String taxAccount) {
		this.taxAccount = taxAccount;
	}

	public String getBankName() {
		return bankName;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	public String getAccountNumber() {
		return accountNumber;
	}

	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}

	public String getInvoicePostAddress() {
		return invoicePostAddress;
	}

	public void setInvoicePostAddress(String invoicePostAddress) {
		this.invoicePostAddress = invoicePostAddress;
	}

	public String getConvenientReceive() {
		return convenientReceive;
	}

	public void setConvenientReceive(String convenientReceive) {
		this.convenientReceive = convenientReceive;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public java.sql.Timestamp getOrderGenerateTime() {
		return orderGenerateTime;
	}

	public void setOrderGenerateTime(java.sql.Timestamp orderGenerateTime) {
		this.orderGenerateTime = orderGenerateTime;
	}

	public String getCouponAccount() {
		return couponAccount;
	}

	public void setCouponAccount(String couponAccount) {
		this.couponAccount = couponAccount;
	}

	public Double getCouponScore() {
		return couponScore;
	}

	public void setCouponScore(Double couponScore) {
		this.couponScore = couponScore;
	}

	public Double getIntegrationScore() {
		return integrationScore;
	}

	public void setIntegrationScore(Double integrationScore) {
		this.integrationScore = integrationScore;
	}

	public Double getTotallPrice() {
		return totallPrice;
	}

	public void setTotallPrice(Double totallPrice) {
		this.totallPrice = totallPrice;
	}

	public Double getNeedPayment() {
		return needPayment;
	}

	public void setNeedPayment(Double needPayment) {
		this.needPayment = needPayment;
	}
	public String getDesPlusOrderId(){
		if (null == this.getOrderId() || "".equals(this.getOrderId())) {
			return "";
		} else {
			return DESPlusUtil.encrypt(this.getOrderId());
		}
			
	}
	public String getConsigneeProvinceDesc(){
		
		if (null == this.getConsigneeProvince() || "".equals(this.getConsigneeProvince())) {
			return "";
		}else {
			IProvinceService provinceService = (IProvinceService)SpringFacesUtil.getManagedBean(SpringBeanConstants.PROVINCE_SERVICE_BEAN_NAME);
			provinceService.setEntityClass(Province.class);
			provinceService.setPKClass(Long.class);
			Province province = (Province) provinceService.get(new Long(this.getConsigneeProvince()));
			return province.getName();
		}
	}
	public String getConsigneeCityDesc(){
		
		if (null == this.getConsigneeCity() || "".equals(this.getConsigneeCity())) {
			return "";
		}else {
			ICityService cityService = (ICityService)SpringFacesUtil.getManagedBean(SpringBeanConstants.CITY_SERVICE_BEAN_NAME);
			cityService.setEntityClass(City.class);
			cityService.setPKClass(Long.class);
			City city = (City) cityService.get(new Long(this.getConsigneeCity()));
			return city.getName();
		}
	}
	public String getConsigneeCountyDesc(){
		
		if (null == this.getConsigneeCounty() || "".equals(this.getConsigneeCounty())) {
			return "";
		}else {
			ICountyService countyService = (ICountyService)SpringFacesUtil.getManagedBean(SpringBeanConstants.COUNTY_SERVICE_BEAN_NAME);
			countyService.setEntityClass(County.class);
			countyService.setPKClass(Long.class);
			County county = (County) countyService.get(new Long(this.getConsigneeCounty()));
			return county.getName();
		}
	}
}
